SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].[usp_VerifyLecture]
    (
      @JOL_Lecture_No INT,
      --@JOL_Lecture_Title VARCHAR(50),
      @JOL_Lecture_VerifyStatus VARCHAR(50),
      @JOL_Lecture_VerifyUser VARCHAR(50),
      @JOL_Lecture_VerifyTime DATETIME
    )
AS 
    DECLARE @ID INT
    SET @ID = (
                SELECT  JOL_Lecture_Purpose
                FROM    dbo.JOL_Lecture
                WHERE   JOL_Lecture_No = @JOL_Lecture_No
              )
    UPDATE  dbo.JOL_ApplyField
    SET     JOL_Field_VerifyStatus = @JOL_Lecture_VerifyStatus,
            JOL_Field_VerifyUser = @JOL_Lecture_VerifyUser
    WHERE   JOL_Field_No = @ID
    UPDATE  dbo.JOL_Lecture
    SET     JOL_Lecture_VerifyStatus = @JOL_Lecture_VerifyStatus,
            JOL_Lecture_VerifyTime = GETDATE(),
            JOL_Lecture_VerifyUser = @JOL_Lecture_VerifyUser
    WHERE   JOL_Lecture_No = @JOL_Lecture_No

GO
